package br.feevale.jogo.util;

import java.util.Random;

import br.feevale.jogo.view.GameView;

public class SincronizaSetups extends Thread {
	
	private GameView gameView;
	
	public SincronizaSetups(GameView gameView) {
		this.gameView = gameView;
	}
	
	@Override
	public void run() {
		
		while (!(gameView.setupsInformados())){
			if (AgenteEnum.GANSO.equals(gameView.getAgente())) {
				gameView.getPorta().sendCommand(CommandEnum.BTN_GANSO.getKey());
			} else if (AgenteEnum.RAPOSA.equals(gameView.getAgente())) {
				gameView.getPorta().sendCommand(CommandEnum.BTN_RAPOSA.getKey());
			}
			
			try {
				Random random = new Random();
				Thread.sleep(random.nextInt(2000) + 100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
		
		//existem dois jogadores
//		controller.showFieldChooser();
		
	}
	
}
